package com.panopset.sf;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JPanel;
import javax.swing.JTextField;

public class PanTextField extends PanField {

	public PanTextField(final Windoc windoc, final Integer columns,
			final String borderTitle, final String toolTipText) {
		this(windoc, columns, borderTitle, toolTipText, "");
	}

	public PanTextField(final Windoc windoc, final Integer columns,
			final String borderTitle, final String toolTipText,
			final String defaultValue, String key) {
		super(windoc, columns, borderTitle, toolTipText, defaultValue, key);
	}

	public PanTextField(final Windoc windoc, final Integer columns,
				final String borderTitle, final String toolTipText,
				final String defaultValue) {
		this(windoc, columns, borderTitle, toolTipText, defaultValue, "");
	}

	public PanTextField(final Windoc windoc, final String borderTitle,
			final String defaultValue) {
		this(windoc, 10, borderTitle, defaultValue, "");
	}
	
	public JTextField getInnerComponent() {
		return getTF();
	}
//
//	public PanTextField(final Windoc windoc, final String borderTitle,
//			final String defaultValue, final String key) {
//		this(windoc, borderTitle, defaultValue, key);
//	}

	@Override
	protected void populatePanel(final JPanel panel) {
		panel.setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.fill = GridBagConstraints.HORIZONTAL;
		gbc.weightx = 1.0;
		panel.add(getTF(), gbc);
	}

	@Override
	protected String getGuiValue() {
		return getTF().getText();
	}
}
